package com.example.demo.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Fixreceive {
    private int frId;
    private int frGdlsh;
    private String frLinkMan;
    private String frLinkTel;
    private String frLinkPhone;
    private Timestamp frReceiveDate;
    private String frReceiveGoods;
    private Client kh;
    private Order htdd;
    private User jdr;
    private Fixdepartment wxbm;
    private Fixcheck wxjcb;


    @Id
    @Column(name = "fr_ID", nullable = false)
    public int getFrId() {
        return frId;
    }

    public void setFrId(int frId) {
        this.frId = frId;
    }

    @Basic
    @Column(name = "fr_gdlsh", nullable = false)
    public int getFrGdlsh() {
        return frGdlsh;
    }

    public void setFrGdlsh(int frGdlsh) {
        this.frGdlsh = frGdlsh;
    }

    @Basic
    @Column(name = "fr_linkMan", nullable = false, length = 10)
    public String getFrLinkMan() {
        return frLinkMan;
    }

    public void setFrLinkMan(String frLinkMan) {
        this.frLinkMan = frLinkMan;
    }

    @Basic
    @Column(name = "fr_linkTel", nullable = false, length = 20)
    public String getFrLinkTel() {
        return frLinkTel;
    }

    public void setFrLinkTel(String frLinkTel) {
        this.frLinkTel = frLinkTel;
    }

    @Basic
    @Column(name = "fr_linkPhone", nullable = false, length = 20)
    public String getFrLinkPhone() {
        return frLinkPhone;
    }

    public void setFrLinkPhone(String frLinkPhone) {
        this.frLinkPhone = frLinkPhone;
    }

    @Basic
    @Column(name = "fr_receiveDate", nullable = false)
    public Timestamp getFrReceiveDate() {
        return frReceiveDate;
    }

    public void setFrReceiveDate(Timestamp frReceiveDate) {
        this.frReceiveDate = frReceiveDate;
    }

    @Basic
    @Column(name = "fr_receiveGoods", nullable = false, length = 10)
    public String getFrReceiveGoods() {
        return frReceiveGoods;
    }

    public void setFrReceiveGoods(String frReceiveGoods) {
        this.frReceiveGoods = frReceiveGoods;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Fixreceive that = (Fixreceive) o;
        return frId == that.frId &&
                frGdlsh == that.frGdlsh &&
                Objects.equals(frLinkMan, that.frLinkMan) &&
                Objects.equals(frLinkTel, that.frLinkTel) &&
                Objects.equals(frLinkPhone, that.frLinkPhone) &&
                Objects.equals(frReceiveDate, that.frReceiveDate) &&
                Objects.equals(frReceiveGoods, that.frReceiveGoods);
    }

    @Override
    public int hashCode() {
        return Objects.hash(frId, frGdlsh, frLinkMan, frLinkTel, frLinkPhone, frReceiveDate, frReceiveGoods);
    }

    @ManyToOne
    @JoinColumn(name = "fr_clientID", referencedColumnName = "client_id", nullable = false)
    public Client getKh() {
        return kh;
    }

    public void setKh(Client kh) {
        this.kh = kh;
    }

    @ManyToOne
    @JoinColumn(name = "fr_htddh", referencedColumnName = "order_id", nullable = false)
    public Order getHtdd() {
        return htdd;
    }

    public void setHtdd(Order htdd) {
        this.htdd = htdd;
    }

    @ManyToOne
    @JoinColumn(name = "fr_receiverPeopleID", referencedColumnName = "uid", nullable = false)
    public User getJdr() {
        return jdr;
    }

    public void setJdr(User jdr) {
        this.jdr = jdr;
    }

    @ManyToOne
    @JoinColumn(name = "fr_fixDepartmentID", referencedColumnName = "fd_ID", nullable = false)
    public Fixdepartment getWxbm() {
        return wxbm;
    }

    public void setWxbm(Fixdepartment wxbm) {
        this.wxbm = wxbm;
    }

    @OneToOne(mappedBy = "wxjjb")
    public Fixcheck getWxjcb() {
        return wxjcb;
    }

    public void setWxjcb(Fixcheck wxjcb) {
        this.wxjcb = wxjcb;
    }
}
